<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //用while和switch语句做(特定值、匹配的过程)、数据类型的转换
        //Balance表示当前账户余额
        var Balance = 100;
        var message = prompt('请输入您要的操作:' + '\n' + '1.存钱' + '\n' + '2.取钱' + '\n' + '3.显示余额' + '\n' + '4.退出');
        message = parseFloat(message);
        while (message == 1 || message == 2 || message == 3 || message == 4) {
            switch (message) {
                case 1:
                    var save_money = prompt('请输入您要存入的钱数:');
                    var current_money = Balance + parseFloat(save_money);
                    alert('您的余额为:' + current_money);
                    break;
                case 2:
                    withdraw_money = prompt('请输入您要取的钱数:');
                    current_money = Balance - parseFloat(withdraw_money);
                    alert('您的余额为:' + current_money);
                    break;
                case 3:
                    alert('您的余额为:' + Balance);
                    break;
                case 4:
                    alert('正在退出~');
                    break;
            }
        }
        alert('您输入的信息有误,请您重新输入~');
    </script>
</head>

<body>

</body>

</html>